package com.longe.netty.byteBuf;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.util.CharsetUtil;

public class NettyByteBuf2 {

    public static void main(String[] args) {

        //创建ByteBuf
        ByteBuf byteBuf = Unpooled.copiedBuffer("hello,world!", CharsetUtil.UTF_8);

        //按照某个范围读取
        System.err.println(byteBuf.getCharSequence(0, 4, CharsetUtil.UTF_8));
        System.err.println(byteBuf.getCharSequence(2, 6, CharsetUtil.UTF_8));

    }
}
